/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author lqik2004
 */
public class stComputeTime {
    /* private int stYear;
    private int stMonth;
    private int stDay;
    private String stText;
    private int stBeginHour;
    private int stBeginMin;
    private int stEndHour;
    private int stEndMin;
    //get/set METHODS......
    public int getYear(){
    return stYear;
    }
    public void  setYear(int y){
    stYear=y;
    }
    public int getMonth(){
    return stMonth;
    }
    public void setMonth(int m){
    stMonth=m;
    }       
    public int getDay(){
    return stDay;
    }
    public void setDay(int d){
    stDay=d;
    }
    public String getText(){
    return stText;
    }
    public void setText(String t){
    stText=t;
    }
    public int getBH(){
    return stBeginHour;
    }
    public void setBH(int BH){    
    stBeginHour=BH;
    }
    public int getBM(){
    return stBeginMin;
    }
    public void setBM(int BM){    
    stBeginMin=BM;
    }
    public int getEH(){
    return stEndHour;
    }
    public void setEH(int EH){    
    stEndHour=EH;
    }
    public int getEM(){
    return stEndMin;
    }
    public void setEM(int EM){    
    stEndMin=EM;
    }*/

    int getBH = Integer.parseInt(FirstFrame.stBH.getText());
    int getBM = Integer.parseInt(FirstFrame.stBM.getText());
    int getEH = Integer.parseInt(FirstFrame.stEH.getText());
    int getEM = Integer.parseInt(FirstFrame.stEM.getText());

    public int computeTime() {
        int cTime;
        if ((getEM < getBM) && (getEH > getBH)) {
            cTime = (getBM - getEM) + (getEH - getBH - 1) * 60;
        } else if ((getEM < getBM) && (getEH < getBH)) {
            cTime = (getBM - getEM) + (24 + getEH - getBH - 1) * 60;
        } else if (getEH < getBH) {
            cTime = (getEM - getBM) + (24 + getEH - getBH) * 60;
        } else {
            cTime = (getEM - getBM) + (getEH - getBH) * 60;
        }
        return cTime;
    }
}
